package main.com.cyz.Recursion;

/**
 * @author fox
 * @version 1.0
 * @description 反向打印字符串
 * @date 2024/5/17 10:19
 */
public class ReversePrintString {

    static StringBuilder builder = new StringBuilder();

    public static String print(String text){
        f(text,0);
        return builder.toString();
    }

    private static void f(String text,int index){
        if (index == text.length()){
            return;
        }
        f(text,index + 1);
        builder.append(text.charAt(index));
    }

}
